<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.mytrip.model.Userinfo"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>出发吧</title>
<meta http-equiv="Content-Type"tent="text/html; charset=utf-8" />
<jsp:include page="/common/include_js.jsp" />
<link rel="stylesheet" type="text/css" media="screen" href="<%=request.getContextPath() %>/front/css/css.css" />
</head>
<script type="text/javascript">
 function check_email(){
    	//var email=$("user.email").value.replace(/(^ *)|( *$)/g,"");
    	var email=$('_email').value;
		if(email=="" )
			return 1;
        
        //var pattern =   /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
        var pattern =/^\w+([-+.]{0,3}\w+)*@[\w\W]*$/
        if(!pattern.test(email))
        	return 2;
        
        return 0;
    }
    
        
    function check_pwd1(){
    	//var password=$("user.password").value.replace(/(^ *)|( *$)/g,"");
    	var password=$("_pwd").value;
		if(password=="")
			return 1;
		if(password.length>20)
        	return 2;
        if(password.length<6)
        	return 3;
        	
        var pattern = /^\w+$/;
        if(!pattern.test(password))
           return 4;
  
	   
	   return 0;
    
    }
    
    function check_pwd2(){
    	//var password=$("user.password").value.replace(/(^ *)|( *$)/g,"");
        //var password2=$("password2").value.replace(/(^ *)|( *$)/g,"");
		var password=$("_pwd").value;
		var password2=$("password2").value;
		if(password2=="")
			return 1;
		
		if(password!=password2)
			return 2;
		
		return 0;
    }

	var subForm=function(){
		var check_email_rs=check_email();
		
			if(check_email_rs==1){
				alert("Email不能为空");
			    $("_email").focus();
				return false;
			}else if(check_email_rs==2){
				alert("请输入正确的Email地址");
	            $("_email").focus();
	            return false;
			}
	
	        var check_pwd1_rs=check_pwd1();
	        if(check_pwd1_rs==1){
	        	alert("密码不能为空");
			    $("_pwd").focus();
				return false;
	        }else if(check_pwd1_rs==2){
	            alert("密码长度不能超过20");
			    $("_pwd").focus();
				return false;
	        }else if(check_pwd1_rs==3){
	        	alert("密码长度不能少于6");
			    $("_pwd").focus();
				return false;
	        }else if(check_pwd1_rs==4){
	        	alert("密码必须由英文和数字组成");
			    $("_pwd").focus();
				return false;
	        }
	        
	        var check_pwd2_rs=check_pwd2();
	        if(check_pwd2_rs==1){
	         	alert("重复密码不能为空");
			    $("password2").focus();
				return false;
	        }else if(check_pwd2_rs==2){
	        	alert("两次密码不一致!");
				$("password2").focus();
				return false;
	        }
		
		document.getElementById('subForm').submit();
	}
</script>
<body>
<div  style="width:960px">
<div id="header">
 <div id="logo"><a href="http://localhost:8090/mytrip" class="logo"></a></div>
 <div  class="fRt" style="margin-top:10px"><p >
            <span>已经拥有出发吧账户？<a href="login.html">立即登录</a></span>

        </p></div>
 </div>
 <div class="reg_page">
    <div class="page_info">
        <h5>快速注册</h5>
        
        <div class="clear"></div>
        <p>以下信息都是<span class="inline_note">必填项</span>。请正确填写以下信息，注册出发吧账户，畅享出发吧所有服务。</p>
    </div>

    <!-- #start reg content -->
    <div class="reg-content">
        <form action="<%=request.getContextPath()%>/front/register!regAdd.action" method="post"  id="subForm">
            <p>
                <b>邮箱：</b><input type="text" class="meetinput" maxlength="80" name="email" id="_email"/><span>请输入有效的邮件地址作为账户登录名，当密码遗失时凭此领取。</span>
            </p>
            <p>
                <b>姓名：</b><input type="text" maxlength="64" name="realName" class="meetinput"  id="_realName"/><span>请输入您的真实姓名方便您创建行程</span>
            </p>
            <p>
                <b>密码：</b><input type="password" maxlength="64" name="pwd" class="meetinput"  id="_pwd"/><span>6-20个字符（字母、数字、特殊字符）区分大小写。</span>
            </p>
            <p class="border">
                <b>确认密码：</b><input type="password" maxlength="64" class="meetinput"  name="password2" id="password2"/>
            </p>
                <button class="inp" type="button" style="cursor:pointer;" onclick="javascript:subForm();">确定并同意以下协议</button>
            <a target="_blank" href="">出发吧用户服务协议</a>
        </form>  

    </div>
    <!-- #end reg content -->
    <jsp:include page="include/bottom.jsp" />
</div>
</div>
</body>
</html>
